Find matching hosts and guests

Find matching hosts and guests in a way that they are both of the same gender and nationality       

Find matching hosts and guests pairs in a way that they are both of the same gender and nationality. Output the host id and the guest id of matched pair.

table name: airbnb_guests

table name: airbnb_hosts

Solution:
select distinct h.host_id,g.guest_id from airbnb_guests as g
join airbnb_hosts as h
on g.nationality = h.nationality and g.gender = h.gender

Comments (0)